# -*- coding:GBK -*-
# -*- Author Zhoutianya -*-

import cg_sound

inst = None

def init(api):
    global inst
    if not inst:
        cg_sound.init()
        inst = CGameSound(api)

class CGameSound(object):
    def __init__(self, api_inst):
        self.api_inst = api_inst
    
    def stop_music(self):
        cg_sound.stop_music()
        
    def play_music(self, file_name, volume):
        cg_sound.play_music(file_name)
        cg_sound.set_volume(volume)
        
    def play_sample(self, file_name, volume=1.0):
        id = cg_sound.play_sample(file_name)
        cg_sound.set_sample_volume(id, volume)
        cg_sound.sample_resume(id)
     
    def destroy(self):
        cg_sound.destroy()
        